#!/usr/bin/ python
# 扫描程序配置，如果新建了payload文件，则在这里调用
import time
import timeit
import sys
import threading
from plugins.payload.ApacheDruid import Druid
from plugins.payload.Apache import Apachevul
from plugins.payload.dedecms import DedeCMS
from plugins.payload.Weblogic import Weblogic
from plugins.payload.Struts import Struts
from plugins.payload.Jboss import Jbosscan
from plugins.payload.ThinkPHP import ThinkPHPv
from plugins.payload.TongdaOA import Tong_da
from plugins.payload.checkcve import checkcve
from plugins.payload.Unauthorize import unauth
from plugins.payload.Seeyon import Seeyoncheck
from plugins.payload import MS15034
from plugins.payload import Minio


from concurrent.futures import ThreadPoolExecutor
R = threading.Lock()
pool = ThreadPoolExecutor(100)
def check_cve(url):
    try:
        pool.submit(checkcve.check_CVE_2020_8209,url)
        pool.submit(checkcve.check_CVE_2019_12725,url)
        pool.submit(checkcve.check_CVE_2019_15017,url)
        pool.submit(checkcve.check_CVE_2021_3019,url)
        pool.submit(checkcve.check_CVE_2021_41773,url)
        pool.submit(checkcve.thinkcmf,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_jboss(url):
    try:
        pool.submit(Jbosscan.jboss_scan,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_tongda(url):
    try:
        pool.submit(Tong_da.unauthorize,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_ms15034(url):
    try:
        pool.submit(MS15034.ms15_034,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_druid(url):
    try:
        pool.submit(Druid.druid_unauthorize,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_web_brute(url):
    try:
        pool.submit(Minio.minio_default_passwd,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_struts(url):
    try:
        pool.submit(Struts.st032,url)
        pool.submit(Struts.st045,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_unanth(host):
    try:
        pool.submit(unauth.redis,host)
        pool.submit(unauth.memcached,host)
        pool.submit(unauth.elasticsearch,host)
        pool.submit(unauth.zookeeper,host)
        pool.submit(unauth.docker,host)
        pool.submit(unauth.hadoop,host)
        pool.submit(unauth.jenkins,host)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_seeyon(url):
    try:
        pool.submit(Seeyoncheck.ajax,url)
        pool.submit(Seeyoncheck.get_sessionlist,url)
        pool.submit(Seeyoncheck.htmlofficeservlet,url)
        pool.submit(Seeyoncheck.createMysql,url)
        pool.submit(Seeyoncheck.DownExcelBeanServlet,url)
        pool.submit(Seeyoncheck.initDataAssess,url)
        pool.submit(Seeyoncheck.status,url)
        pool.submit(Seeyoncheck.test_jsp_sqli,url)
        pool.submit(Seeyoncheck.setextno_sqli,url)
        pool.submit(Seeyoncheck.resendjsp_sqli,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_dedecms(url):
    try:
        pool.submit(DedeCMS.check_CVE_2018_6910,url)
        pool.submit(DedeCMS.dedecms_url_redirection,url)
        pool.submit(DedeCMS.dedesql_class_sqli,url)
        pool.submit(DedeCMS.advancedsearch_sqli,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_thinkphp(url):
    try:
        pool.submit(ThinkPHPv.thinkphp_checkcode_time_sqli,url)
        pool.submit(ThinkPHPv.thinkphp_construct_code_exec,url)
        pool.submit(ThinkPHPv.thinkphp_construct_debug_rce,url)
        pool.submit(ThinkPHPv.thinkphp_driver_display_rce,url)
        pool.submit(ThinkPHPv.thinkphp_index_construct_rce,url)
        pool.submit(ThinkPHPv.thinkphp_index_showid_rce,url)
        pool.submit(ThinkPHPv.thinkphp_invoke_func_code_exec,url)
        pool.submit(ThinkPHPv.thinkphp_lite_code_exec,url)
        pool.submit(ThinkPHPv.thinkphp_method_filter_code_exec,url)
        pool.submit(ThinkPHPv.thinkphp_pay_orderid_sqli,url)
        pool.submit(ThinkPHPv.thinkphp_multi_sql_leak,url)
        pool.submit(ThinkPHPv.thinkphp_request_input_rce,url)
        pool.submit(ThinkPHPv.thinkphp_view_recent_xff_sqli,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_apache(url):
    try:
        pool.submit(Apachevul.apache_example,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_weblogic(url):
    try:
        pool.submit(Weblogic.check_CVE_2018_2894,url)
        pool.submit(Weblogic.check_weblogic_console,url)
        pool.submit(Weblogic.check_cve_2014_4210,url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()

def check_all(url):
    try:
        print("[*] Checking...Please wait\n")
        check_apache(url)
        check_seeyon(url)
        check_cve(url)
        check_web_brute(url)
        check_ms15034(url)
        check_dedecms(url)
        check_druid(url)
        check_jboss(url)
        check_struts(url)
        check_tongda(url)
        check_thinkphp(url)
        check_weblogic(url)
    except Exception as e:
        pass
    except KeyboardInterrupt:
        sys.exit()